﻿using System.Collections.Specialized;
using System.Web;

namespace WholesaleOnline.Controller.Request
{
    public class WebRequestFactory : IWebRequestFactory
    {
        public WebRequest CreateFrom(string requestedUrl, NameValueCollection queryArguments = null)
        {
            WebRequest webRequest = new WebRequest();
            webRequest.RequestedURL = requestedUrl;
            webRequest.QueryArguments = queryArguments;
            webRequest.LoginId = SessionCache.LognID;
            return webRequest;
        }

        public WebRequest CreateFrom(HttpContext context)
        {
            return CreateFrom(context.Request.Url.ToString(), context.Request.Params);
        }
    }
}
